﻿#region 命名空间

using System;

#endregion

namespace Sharp.Infrastructure
{
    /// <summary>
    ///     Represents that the derived classes are disposable objects.
    /// </summary>
    public abstract class DisposableObject : IDisposable
    {
        #region 析构函数

        /// <summary>
        ///     Finalizes the object.
        /// </summary>
        ~DisposableObject()
        {
            Dispose(false);
        }

        #endregion

        #region Protected Methods

        /// <summary>
        ///     Disposes the object.
        /// </summary>
        /// <param name="disposing">
        ///     A <see cref="System.Boolean" /> value which indicates whether
        ///     the object should be disposed explicitly.
        /// </param>
        protected abstract void Dispose(bool disposing);

       

        #endregion

        #region IDisposable Members

        /// <summary>
        ///     Performs application-defined tasks associated with freeing, releasing, or
        ///     resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        #endregion
    }
}